class Solution(object):
    def findErrorNums(self, nums):
        """
        :type nums: List[int]
        :rtype: List[int]
        """
        out = []
        for num in nums:
            if nums[abs(num) - 1] < 0:
                out.append(abs(num))
            else:
                nums[abs(num) - 1] = - nums[abs(num) - 1]
        for i, num in enumerate(nums):
            if num > 0:
                out.append(i + 1)
                break
        return out